package ma.ensias.healthme.admin;

import java.util.ArrayList;

import com.google.android.gms.internal.ch;

import ma.ensias.healthme.R;
import ma.ensias.healthme.entities.Maladie;
import ma.ensias.healthme.entities.PointTrait;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
public class PTLazyAdapter extends BaseAdapter {
    
    private Activity activity;
    private ArrayList<PointTrait> data;
    private static LayoutInflater inflater=null;
    
    public PTLazyAdapter(Activity a, ArrayList<PointTrait> d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public int getCount() {
        return data.size();
    }

    public Object getItem(int position) {
        return data.get(position);
    }

    public long getItemId(int position) {
        return position;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) {
		View vi=convertView;
		if(convertView==null)
		 vi = inflater.inflate(R.layout.pt_row, null);
		
		
		TextView maladie = (TextView)vi.findViewById(R.id.maladieL); // title
		TextView num = (TextView)vi.findViewById(R.id.num); // title
		PointTrait m=data.get(position);
		maladie.setText(m.getLibelle());
		num.setText(""+(position+1));
		
		
		return vi;
    }
}